package chapter3.No3_1_等待和通知机制.i等待wait的条件发生变化;

/**
 * Created by Administrator on 2016/11/18.
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        String lock = new String();
        Add add = new Add(lock);
        Subtract subtract = new Subtract(lock);
        ThreadSubtract subtract1 = new ThreadSubtract(subtract);
        subtract1.setName("subtract1");
        ThreadSubtract subtract2 = new ThreadSubtract(subtract);
        subtract2.setName("subtract2");
        subtract1.start();
        subtract2.start();

        Thread.sleep(1000);
        ThreadAdd add1 = new ThreadAdd(add);
        add1.setName("add1");
        add1.start();

    }
}
